# -*- coding:utf-8 -*-
from datetime import datetime
from functools import wraps
from flask import request
from flask import session
from info.models import User

def pro_blue(func):
    @wraps(func)
    def func1(*args,**kwargs):
        user=None
        user_id = session.get('user_id')
        if user_id:
            user = User.query.filter(User.id == user_id).first()
            if user:
                user.update_time=datetime.now()
        from flask import g
        g.user = user
        return func(*args,**kwargs)
    return func1